home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / prog_c / cuj0696.zip / DWYER.ZIP / LIB / GETLONG.C < prev    next >
C/C++ Source or Header  |  1995-10-02  |  627b  |  34 lines

  1. /* ============ */
  2. /* GetLong.c    */
  3. /* ============ */
  4. #include <stdio.h>
  5.  
  6. #define    FLUSH_LINE(u)            \
  7.     {                    \
  8.     int    x;            \
  9.     do                \
  10.     {                \
  11.         x = getc(u);        \
  12.     }                \
  13.     while (x != EOF && x != '\n');    \
  14.     }
  15. /* ==================================================== */
  16. /* GetLong - prompts operator with s to get long int i    */
  17. /* ==================================================== */
  18. # if defined(__STDC__) || defined(__PROTO__)
  19. void
  20. GetLong(char *s, long *i)
  21. # else
  22. void
  23. GetLong(s, i)
  24. char    *s;
  25. long    *i;
  26. # endif
  27. {
  28.     fprintf(stderr, "%s", s);
  29.  
  30.     scanf("%ld", i);
  31.  
  32.     FLUSH_LINE(stdin);
  33. }
  34.